class Hook {
    constructor(args){
        if(!Array.isArray(args)){
            args=[];
        }
        this._args = args;//['name','age']
        this.taps = [];
        this._x;//这里放着我们的监听函数的数组
    }
    tap(options,fn){
        if(typeof options === 'string'){
            options = {name:options};
        }
        options.fn = fn;//options={name,fn};
        this._insert(options);
    }
    _insert(item){
        //this.taps[this.taps.length]=item;
        this.taps.push(item);
    }
    call(...args){
        let callMethod = this._createCall();
        callMethod.apply(this,args);
    }
    _createCall(){
        return this.compile({
            taps:this.taps,
            args:this._args
        })
    }
}
module.exports = Hook;